BridgeJS: Add swift-format-ignore-file to generated Swift sources#732
Merged
BridgeJS: Add swift-format-ignore-file to generated Swift sources#732
Conversation
c2c007e to
26935ed
Compare
kateinoigakukun
approved these changes
Apr 30, 2026
Member
Author
|
The CI failure ( |
26935ed to
1c107ad
Compare
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Adds
// swift-format-ignore-fileto the header of all BridgeJS-generated Swift files (BridgeJS.swiftandBridgeJS.Macros.swift), so thatswift format lintskips them automatically.Fixes #708.
Users who run
swift format linton their projects currently get violations on generated files. Since these files are regenerated byswift package bridge-js, manually adding the comment is not viable — it gets overwritten. Configuring swift-format to exclude specific directories is also surprisingly difficult.This is standard practice for Swift code generators (protobuf-swift, grpc-swift, SwiftGen all do the same).
1.
Utilities.swift— added// swift-format-ignore-filetoBridgeJSGeneratedFile.swiftHeader, after the// bridge-js: skipmarker (which must remain on line 1).2.
cli.js— added// swift-format-ignore-fileas the first line of the TS2Swiftpreludetemplate.